package org.kabeja.parser.objects;

import org.kabeja.dxf.DXFDocument;
import org.kabeja.dxf.objects.DXFObject;
import org.kabeja.parser.DXFValue;

/**
 * @author shutao
 * @since 2022/4/25 12:09
 */
public abstract class AbstractDXFObjectHandler implements DXFObjectHandler {
    public static final int GROUPCODE_SOFTPOINTER_ID = 330;
    public static final int GROUPCODE_HARDOWNER_ID = 360;
    public static final int GROUPCODE_HANDLE_ID = 5;
    protected DXFDocument doc;

    public AbstractDXFObjectHandler() {
    }

    @Override
    public void releaseDXFDocument() {
        this.doc = null;
    }

    @Override
    public void setDXFDocument(DXFDocument var1) {
        this.doc = var1;
    }

    protected void parseCommonGroupCode(int var1, DXFValue var2, DXFObject var3) {
        switch(var1) {
            case GROUPCODE_HANDLE_ID:
                var3.setID(var2.getValue());
                break;
            case GROUPCODE_SOFTPOINTER_ID:
                var3.setSoftPointerID(var2.getValue());
                break;
            case GROUPCODE_HARDOWNER_ID:
                var3.setHardOwnerID(var2.getValue());
                break;
            default:
                break;
        }

    }
}
